]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
messageTray: Don't add ourselves more than once to CtrlAltTabManager
authorRui Matos <tiagomatos@gmail.com>
Fri, 7 Dec 2012 11:09:42 +0000 (12:09 +0100)
committerRui Matos <tiagomatos@gmail.com>
Mon, 10 Dec 2012 10:50:05 +0000 (11:50 +0100)
This way _sessionUpdated() can be called multiple times without side
effects.

https://bugzilla.gnome.org/show_bug.cgi?id=689959

js/ui/messageTray.js

index 6b7199e925eff01d763ce6a6b16cd2530843bbbc..e72e959fca6e97365c7ca4f6a00a7c3b2f696eb7 100644 (file)
@@ -1485,6 +1485,7 @@ const MessageTray = new Lang.Class({
         this._reNotifyAfterHideNotification = null;
         this._inFullscreen = false;
         this._desktopClone = null;
+        this._inCtrlAltTab = false;
 
         this._lightbox = new Lightbox.Lightbox(global.window_group,
                                                { inhibitEvents: true,
@@ -1562,12 +1563,15 @@ const MessageTray = new Lang.Class({
     },
 
     _sessionUpdated: function() {
-        if (Main.sessionMode.isLocked || Main.sessionMode.isGreeter)
+        if ((Main.sessionMode.isLocked || Main.sessionMode.isGreeter) && this._inCtrlAltTab) {
             Main.ctrlAltTabManager.removeGroup(this._summary);
-        else
+            this._inCtrlAltTab = false;
+        } else if (!this._inCtrlAltTab) {
             Main.ctrlAltTabManager.addGroup(this._summary, _("Message Tray"), 'user-available-symbolic',
                                             { focusCallback: Lang.bind(this, this.toggleAndNavigate),
                                               sortGroup: CtrlAltTab.SortGroup.BOTTOM });
+            this._inCtrlAltTab = true;
+        }
         this._updateState();
     },